package org.mg.frontend.security;

import org.springframework.security.authentication.dao.SaltSource;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * @author MG
 * @since 06-04-2013
 */
public class AuthSaltSource implements SaltSource {
    public static final int SALT_LENGTH = 21;
    public static final int BASE64_SALT_LENGTH = 28;

    @Override
    public Object getSalt(UserDetails user) {
        String password = user.getPassword();
        return password.substring(0, BASE64_SALT_LENGTH);
    }
}
